import React, { Component } from 'react'

import { StackNavigator } from 'react-navigation';
import {
    BackHandler,
    ToastAndroid,
} from 'react-native';

import Back from './HOC/Back'
import App from './routers/app'
import Hehe from './routers/Hehe'
import Spalsh from './routers/spalsh/spalsh'


// 所有导航页面在这注册

export default StackNavigator({

    'spalsh': {
        screen: Spalsh,
        navigationOptions: {
            header: null
        }
    },
    'App': {
        screen: App,
        navigationOptions: {
            header: null
        }
    },
    'Hehe': {
        screen: Hehe,
        navigationOptions: {
            header: null
        }
    },


}, {
    initialRouteName: 'spalsh', // 默认显示界面
    // mode:"none",
    // headerMode:"none",
    transitionConfig: () => {
        screenInterpolator: TransitionConfiguration
    },
})

//动画样式
const TransitionConfiguration = () => {
    return {
        transitionSpec: {
            duration: 300,
            easing: Easing.linear(),
            timing: Animated.timing,
        },
        screenInterpolator: (sceneProps) => {
            const { scene, scenes } = sceneProps;
            const { route, index } = scene;
            const params = route.params || {};
            const transition = params.transition || 'forHorizontal';

            switch (transition) {
                case 'forVerticalTop':
                    return forVerticalTop(sceneProps);

                case 'forHorizontalLeft':
                    return forHorizontalLeft(sceneProps);
                case 'freeStyle':
                    return freeStyle(sceneProps);
                default:
                    return CardStackStyleInterpolator[transition](sceneProps);
            }
        },
    };
};